package com.springfox.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfig {
    @Bean
    public Docket getDocket(){
        //docket这个对象springfox会自动创建，假如配置springfox不在创建
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(swaggerDemoApiInfo())
                .select()
                .build();
    }
    private ApiInfo swaggerDemoApiInfo(){
        return new ApiInfoBuilder()
                .contact(new Contact("北京尚学堂", "http://www.bjsxt.com", "xxx@163.com"))
                // 文档标题
                .title("这里是Swagger的标题")
                // 文档描述
                .description("这里是Swagger的描述")
                // 文档版本
                .version("1.0.0")
                .build();
    }
}
